package april.test_4_8;

import java.io.StringReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class TestMain2 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextInt()) {
            int n = scanner.nextInt();
            String[] strings = new String[n];
            String s = scanner.nextLine();
            for (int i = 0; i < n; i++) {
                strings[i] = scanner.nextLine();
            }
            String[][] stringss = results(strings);
            ArrayList<Integer> arrayList = isRemove(stringss);
            for (int i = 0; i < stringss.length; i++) {
                if(!arrayList.contains(i)) {
                    String[] sts = stringss[i];
                    System.out.print("mkdir -p ");
                    for (int j = 0; j < sts.length; j++) {
                        if(j != 0) {
                            System.out.print("/");
                        }
                        System.out.print(sts[j]);
                    }
                    System.out.println();
                }
            }
            System.out.println(arrayList.size());
            for (int i = 0; i < arrayList.size(); i++) {
                System.out.println(arrayList.get(i));
                System.out.println();
            }
        }
    }
    public static String[][] results(String[] strings) {
        String[][] stringss = new String[strings.length][];
        for (int i = 0; i < strings.length; i++) {
            String[] array = strings[i].split("/");
            stringss[i] = array;
        }
        return stringss;
    }
    public static ArrayList<Integer> isRemove(String[][] stringss) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        for (int i = 0; i < stringss.length; i++) {
            String[] strings = stringss[i];
            for (int j = i + 1; j < stringss.length; j++) {
                boolean b = false;
                String[] tmp = stringss[j];
                for (int count = 0; count < strings.length && count < tmp.length; count++) {
                    if(!tmp[count].equals(strings[count])) {
                        b = true;
                    }
                }
                if (!b) {
                    if(tmp.length < strings.length) {
                        arrayList.add(j);
                    } else {
                        arrayList.add(i);
                    }
                }
            }
        }
        return arrayList;
    }
}
